'''
    把Base页面导入，定位
'''
import time,logging

from month_8_8.Base.Base import Base
from selenium.webdriver.common.by import By
from month_8_8.Tools.Tools import Tools
class Page(Base):
    # 点击登录
    Tools().log()
    click_login_loc = (By.XPATH,'/html/body/div[1]/div/div[2]/ul/li[1]/a')
    logging.debug('click_login')
    def click_login(self):
        self.click(self.click_login_loc)
    # 输入账号
    logging.debug('username')
    username_loc = (By.XPATH,'//input[@name="username"]')
    def username(self,username):
        self.send_keys(self.username_loc,username)
    # 输入密码
    logging.debug('password')
    password_loc = (By.XPATH,'/html/body/div[4]/div/div[1]/div[2]/form/div[2]/span[2]/input')
    def password(self,password):
        self.send_keys(self.password_loc,password)
    # 点击登录按钮
    logging.debug('finsh_but')
    finsh_but_loc = (By.CLASS_NAME,'finish-btn')
    def finsh_but(self):
        self.click(self.finsh_but_loc)


    def a3mall_login_001(self,):
        self.open_url('http://10.59.9.12:7001/')
        self.click_login()
    def a3mall_login_002(self,username):
        self.username(username)
    def a3mall_login_003(self, password):
        self.password(password)
        # 强制等待
        time.sleep(10)
        self.finsh_but()
